#pragma once

#include "dcl_ModelObj.h"
#include "Afx.h"
#include "Pos.h"

class DEF_MODELOBJ CVec
{
public:
	CVec(void);
	CVec(double dblX, double dblY, double dblZ);
	virtual ~CVec(void);

public:
	bool Normalise();
	double GetLength() const;
	bool IsZero(double dblTol=0.001) const;
	double DotProduct(const CVec & vec) const;
	CVec CrossProduct(const CVec & vec) const;
	double AngleTo(const CVec & vec, const CVec *pRefVec=NULL) const;
	bool IsParallel(const CVec & vec, double dblTol=0.001) const;
	bool IsPerpendicular(const CVec & vec, double dblTol=0.001) const;

public:
	double GetVecX() const;
	void SetVecX(double dblX);
	double GetVecY() const;
	void SetVecY(double dblY);
	double GetVecZ() const;
	void SetVecZ(double dblZ);
	double operator[](int nIndex) const;

protected:
	double m_dblVecX;
	double m_dblVecY;
	double m_dblVecZ;
};

DEF_MODELOBJ CVec operator * (double k, const CVec & vec);
DEF_MODELOBJ CPos operator + (const CPos & pos, const CVec & vec);
DEF_MODELOBJ CPos operator - (const CPos & pos, const CVec & vec);
DEF_MODELOBJ CVec operator - (const CPos & pos1, const CPos & pos2);
DEF_MODELOBJ CVec operator - (const CVec & vec);
DEF_MODELOBJ CVec operator + (const CVec & vec1, const CVec & vec2);
DEF_MODELOBJ CVec operator - (const CVec & vec1, const CVec & vec2);
